<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入 vue.js 文件 -->
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <h2> {{firstName}} {{lastName}}</h2>

        <h2> {{firstName + ' ' + lastName}} </h2>

        <h2> {{getFullName()}} </h2>

        <h2> {{FullName}} </h2>
    </div>
    <script>
        new Vue({
            el: "#app",
            data: {
                message: "Hello Vue",
                firstName: "TMQQ",
                lastName: "OUOO",
            },
            // computed 计算属性
            // 可以直接使用属性名调用，不需要加括号
            computed: {
                FullName: function () {
                    return this.firstName + ' ' + this.lastName;
                }
            },
            methods: {
                getFullName() {
                    return this.firstName + ' ' + this.lastName;
                }
            }
        });
    </script>
</body>

</html>